Conditions | 7 |
Paths | 12 |
Total Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | (() => { |
||
3 | const detectJs = chain => { |
||
4 | const properties = chain.split('.'); |
||
5 | |||
6 | let value = properties.length ? window : null; |
||
7 | |||
8 | for ( let i = 0; i < properties.length; i ++ ) { |
||
9 | let property = properties[i]; |
||
10 | |||
11 | if ( value && value.hasOwnProperty(property) ) { |
||
12 | value = value[property]; |
||
13 | } else { |
||
14 | value = null; |
||
15 | |||
16 | break; |
||
17 | } |
||
18 | } |
||
19 | |||
20 | return typeof value === 'string' || typeof value === 'number' ? value : !!value; |
||
21 | }; |
||
22 | |||
62 |